<template>
  <a-drawer :visible="versionDrawer" :footer="false" @cancel="handleCancel">
    <template #title> 版本历史记录 </template>
    <version-card
      v-for="(item, index) in fileVersionData"
      :key="index"
      style="margin-top: 4px"
      :version-detail="item"
      :style="'margin-top:' + (index === 0 ? '4px' : '20px')"
    ></version-card>
  </a-drawer>
</template>

<script lang="ts" setup>
  import useFileManageStore from '@/store/modules/file-manage/index';
  import { storeToRefs } from 'pinia';
  import VersionCard from './card-version.vue';

  const store = useFileManageStore();
  const { versionDrawer, fileVersionData } = storeToRefs(store);

  const handleCancel = () => {
    store.setVersionDrawer(false);
  };
</script>
